import 'package:doctor_examine_lib/doctor_examine_lib.dart';
import 'package:flutter/material.dart';
import 'package:base_lib/index.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  DoctorExamineLib.doInit();
  runApp(TipWrap(MyApp()));
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '医生端用户组件示例',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        backgroundColor: ColorUtil.color("#f6f6f6"),
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: '医生端用户组件示例'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      DoctorExamineLib.initWithContext(context);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              onPressed: () {
                DoctorExamineLib.jump2Login(context);
              },
              child: Text("登录页"),
            )
          ],
        ),
      ),
    );
  }
}
